package com.cyandpos.pad.pay.presenter;


import com.cyandpos.pad.common.commondata.Constant;
import com.cyandpos.pad.pay.model.IPayCardCouponModel;
import com.cyandpos.pad.pay.model.IPayCardCouponModelImpl;
import com.cyandpos.pad.pay.view.IPayCardCouponView;
import com.cyandpos.pad.posdata.CardCouponItem;
import com.cyandpos.pad.posdata.QueryMemberRequest;

import java.util.ArrayList;

/**
 * Created by zx on 2020/3/6.
 */

public class PayCardCouponPresenter {
    private IPayCardCouponModel model;
    private IPayCardCouponView netView;

    public PayCardCouponPresenter(IPayCardCouponView netView){
        this.netView = netView;
        this.model = new IPayCardCouponModelImpl();
    }

    /**
     * 卡券查询
     * @param data
     */
    public  void yhqkRequest(QueryMemberRequest data){
        netView.showProgress("正在查询卡券信息，请稍等……");
        model.loadYhqkInfo(data, new IPayCardCouponModel.YhqkRequestListener() {
            @Override
            public void getyhqkInfoSuccess(ArrayList<CardCouponItem> yhqList) {
                netView.dismissProgress();
                netView.yhqkRequestData(yhqList);
            }

            @Override
            public void getyhqkInfoFailure(String msg) {
                netView.dismissProgress();
                netView.showLoadFailureMsg(msg, Constant.Pay_YHQReq_FailID);
            }
        });
    }

}
